/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package es.gestorusuarios.correo;

import java.security.SecureRandom;

public class GeneradorLink {
 
	public static String NUMEROS = "0123456789";
 
	public static String MAYUSCULAS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
 
	public static String MINUSCULAS = "abcdefghijklmnopqrstuvwxyz";
        
        public static final int lENGTH_LINK = 40;

        
        public static String getLink(){
            return getLink(lENGTH_LINK);
        }
 
	public static String getLink(int length) {
		return getLink(NUMEROS + MAYUSCULAS, length);
	}
        
	public static String getLink(String key, int length) {
		String link = "";
                SecureRandom random = new SecureRandom();
 
		for (int i = 0; i < length; i++) {
			link = link + key.charAt(random.nextInt(key.length()));
		}
 
		return link;
	}
        
        public static void main(String[] argv){
            for(int i = 0; i < 30; i++)
                System.out.println(GeneradorLink.getLink());
        }
}
